/**
 * Copyright(C) 2012 Luvina Software Company
 *
 * MstGroupDaoImpl.java, 2/1/2013, bacdv
 */
package net.luvina.manageuser.dao.impl;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.stereotype.Repository;

import net.luvina.manageuser.dao.MstGroupDao;
import net.luvina.manageuser.hibernate.MstGroup;

/**
 * MstGroupDaoImpl implement MstGroupDao
 *
 * @author bacdv
 *
 */
@Repository("MstGroupDao")
public class MstGroupDaoImpl extends GenericDaoImpl<MstGroup, Integer>
        implements MstGroupDao {

    public MstGroupDaoImpl() {
        super(MstGroup.class);
    }

    /*
     * (non-Javadoc)
     *
     * @see net.luvina.manageuser.dao.MstGroupDao#getListGroup()
     */
    @SuppressWarnings("unchecked")
    public List<MstGroup> getListGroup() {

        HibernateCallback callback = new HibernateCallback() {
            public Object doInHibernate(Session session)
                    throws HibernateException {
                Query query = session.createQuery("FROM MstGroup ");
                return (List<MstGroup>) query.list();
            }
        };
        return (List<MstGroup>) getHibernateTemplate().execute(callback);
    }

}
